<?php
/**
 * @package    Joomla.Tutorials
 * @subpackage Components
 * @link       http://docs.joomla.org/Category:Development
 * @license    GNU/GPL
 */
 
// no direct access
 
defined( '_JEXEC' ) or die( 'Restricted access' );
 
jimport( 'joomla.application.component.view');
 
/**
 * HTML View class for the HelloWorld Component
 *
 * @package    HelloWorld
 */
 
class NvViewBlog extends JView
{
    function display($tpl = null)
    {		
		$document 	=& JFactory::getDocument();		
		$document->addStyleSheet('components/com_nv/assets/css/front.css');
		$document->addStyleSheet('components/com_nv/assets/css/liveval.css');
		$document->addScript('components/com_nv/assets/js/livevalidation.js');
		$document->addScript('components/com_nv/assets/js/jquery-1.3.2.js');
		$document->addScript('components/com_nv/assets/js/jquery.blockUI.js');
		
		$result = JRequest::getVar( 'result' );
		
		// Check if there need a results
		if($result)
		{
			//get the input string
			$str = JRequest::getVar( 'str' );
			
			//call the model
			$model = $this->getModel('blog');
			
//			//Get the Wiki Mashup
//			$wiki = $model->getWikiMashup($str);
//			
//			
//			if(empty($wiki))
//				$wiki = "Bad URL! or Content can't be retreive!";
//			//print $wiki;
//			
//			//Mashup from indonesia.travel
//			$indotravel = $model->getIndoTravel($str);
//			//$indotravel = "Ini dari Indotravel";
//			//print $indotravel;
		
			//Get the Blog Mashup
			$blogs = $model->getBlogMashup($str);
			//$blogs = "Ini dari Wordpress";
			//print $blogs;
			
			//Get the News Mashup
			$news = $model->getNewsMashup($str);
			//print $news;
			
			//send variables to views default
			$this->assignRef( 'wiki', $wiki );
			$this->assignRef( 'indotravel', $indotravel );
			$this->assignRef( 'blogs', $blogs );
			$this->assignRef( 'news', $news );
			
		}//end of if with result
		
		$this->assignRef( 'result', $result );
 
        parent::display($tpl);
    }//end of function display
	
	/*$greeting = "Hello World Muhak!";
		
		$model =& $this->getModel();
		$greeting = $model->getGreeting();
		
        $this->assignRef( 'greeting', $greeting );*/
}
?>
